package com.yami.shop.platform.controller;

import com.yami.shop.bean.dto.SankeyDto;
import com.yami.shop.bean.param.FlowRouteAnalysisParam;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.service.FlowRouteAnalysisService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author lgh on 2018/11/26.
 */
@RestController
@RequestMapping("/platform/flowRouteAnalysis")
@Tag(name = "用户访问路径")
public class FlowRouteAnalysisController {

    @Autowired
    private FlowRouteAnalysisService flowRouteAnalysisService;

    @GetMapping("/getRoutData")
    @Operation(summary =  "分页获取用户访问路径数据", description = "分页获取用户访问路径数据")
    public ServerResponseEntity<FlowRouteAnalysisParam> getRoutData(@ParameterObject FlowRouteAnalysisParam flowRouteAnalysisParam) {
        flowRouteAnalysisParam.setTime();
        SankeyDto sankeyDto = flowRouteAnalysisService.getRoutData(flowRouteAnalysisParam);
        flowRouteAnalysisParam.setSankeyDto(sankeyDto);
        return ServerResponseEntity.success(flowRouteAnalysisParam);
    }
}
